<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>客户名片-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">客户名片</div>
		<div class="right">
			<div class="input-group left w300">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" placeholder="按项目编号/项目名称/姓名/手机搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
		</div>
	</div>
	<div id="content">
		<div class="filter">
			<div class="filter-item">
				<div class="filter-title">项目状态：</div>
				<ul class="filter-order">
					<foreach name="status_list" item="vo">
					<li <if condition="$status_id eq $vo['name2']">class="current"</if>>
						<a href="__APP__/Project/project_contact/keyword/{$keyword}/center_id/{$center_id}/status_id/{$vo['name2']}/mode/{$mode}">{$vo['name1']}</a>
					</li>
					</foreach>
				</ul>
				<div class="filter-title">列表模式：</div>
				<ul class="filter-order">
					<li <if condition="$mode eq 1">class="current"</if>>
						<a href="__APP__/Project/project_contact/keyword/{$keyword}/center_id/{$center_id}/status_id/{$status_id}/mode/1" >客户</a>
					</li>
					<li <if condition="$mode eq 2">class="current"</if>>
						<a href="__APP__/Project/project_contact/keyword/{$keyword}/center_id/{$center_id}/status_id/{$status_id}/mode/2" >项目</a>
					</li>
					
				</ul>
			</div>
		</div>
		<div class="table-scrollx">
			<table class="table table-bordered table-hover table-hover-contact">
				<tr class="table-header fixed-table-header">
					<if condition="$mode eq 1">
						<td width="100" class="nowrap">姓名</td>
						<td class="nowrap">项目编号</td>
					<else/>
						<td class="nowrap">项目编号</td>
						<td width="100" class="nowrap">姓名</td>
					</if>
					<td width="8%" class="nowrap">性别</td>
					<td class="nowrap"><div style="min-width:200px;">公司名称</div></td>
					<td width="100" class="nowrap">职位</td>
					<td width="80" class="nowrap">手机号</td>
					<td width="80" class="nowrap">座机号</td>
					<td width="160" class="nowrap">邮箱</td>
					<td width="162" class="nowrap">地址</td>
					<td width="112" class="nowrap">添加人(日期)</td>
				</tr>
				<if condition="$result eq NULL">
				<tr>
					<td colspan="10" class="text-center">暂无相关内容</td>
				</tr>
				</if>
				<foreach name="result" item="vo">
					<if condition="$mode eq 1">
						<tr>
							<td class="nowrap"><a href="javascript:;" class="detail" mid="{$vo['id']}">{$vo['username']}</a></td>
							<td>
								<foreach name="vo['stage']" item="wo" key="k">
									<if condition="$k neq 0">,</if>
									<span data-toggle="tooltip" data-placement="right" title="{$wo['project_name']}">
										{$wo['project_num']}
									</span>
								</foreach>
							</td>
							<td><if condition="$vo['gender'] eq '男'">男<elseif condition="$vo['gender'] eq '女'"/>女</if></td>
							<td>{$vo['company_name']}</td>
							<td class="nowrap">{$vo['job']}</td>
							<td>{$vo['mobilephone']}</td>
							<td>{$vo['telephone']}</td>
							<td>{$vo['email']}</td>
							<td class="nowrap">{$vo['province']}<if condition="$vo['city_id'] neq NULL">-{$vo['city']}</if></td>
							<td class="nowrap">{$vo['add_user']}<if condition="$vo['add_date'] neq NULL">({$vo['add_date']|substr=0,10})</if></td>
						</tr>
					<elseif condition="$mode eq 2"/>
						<foreach name="vo['detail']" item="wo" key="kk">
						<if condition="$key%2 eq 1"><tr class="interlaced-color"><else/><tr></if>
							<if condition="$kk eq 0">
								<td rowspan="{$vo['sum']}">
									<span data-toggle="tooltip" data-placement="right" title="{$vo['project_name']}">
										{$vo['project_num']}
									</span>
								</td>
							</if>
							<td class="nowrap"><a href="javascript:;" class="detail" mid="{$wo['id']}">{$wo['username']}</a></td>
							<td><if condition="$wo['gender'] eq '男'">男<elseif condition="$wo['gender'] eq '女'"/>女</if></td>
							<td>{$wo['company_name']}</td>
							<td class="nowrap">{$wo['job']}</td>
							<td>{$wo['mobilephone']}</td>
							<td>{$wo['telephone']}</td>
							<td>{$wo['email']}</td>
							<td class="nowrap">{$wo['province']}<if condition="$wo['city_id'] neq NULL">-{$wo['city']}</if></td>
							<td class="nowrap">{$wo['add_user']}<if condition="$wo['add_date'] neq NULL">({$wo['add_date']|substr=0,10})</if></td>
						</tr>
						</foreach>
					</if>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--客户详情-->
<div id="detailModal" class="modal hide fade">
	<div class="modal-dialog w800">
		<div class="modal-content">
			<div class="modal-header">
				<h4 id="myModalLabel">客户详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body"></div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//搜索
	$(".found_btn").keywordSearch("__APP__/Project/project_contact/keyword/$keyword/center_id/{$center_id}/status_id/{$status_id}/mode/{$mode}");
	//客户详情
	$(".detail").on("click",function(){
		var mid = $(this).attr("mid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":mid},
			url:"__APP__/Project/project_card_detail",
			success:function(data){
				var html = "<table class='table table-bordered'>";
				html+="<tr><td class='side_td' width='10%'>姓名</td><td width='40%'>";
				html+=data.username ? data.username : "";
				html+="</td>";
				html+="<td class='side_td' width='10%'>性别</td><td width='40%'>";
				html+=data.gender ? data.gender : "";
				html+="</td></tr>";
				html+="<tr><td class='side_td'>公司名称</td><td>";
				html+=data.company_name ? data.company_name : "";
				html+="</td><td class='side_td'>职位</td><td>";
				html+=data.job ? data.job : "";
				html+="</td></tr>";
				html+="<tr><td class='side_td'>手机号</td><td>";
				html+=data.mobilephone ? data.mobilephone : "";
				html+="</td><td class='side_td'>座机号</td><td>";
				html+=data.telephone ? data.telephone : "";
				html+="</td></tr>";
				html+="<tr><td class='side_td'>QQ</td><td>";
				html+=data.qq ? data.qq : "";
				html+="</td><td class='side_td'>邮箱</td><td>";
				html+=data.email ? data.email : "";
				html+="</td></tr>";
				html+="<tr><td class='side_td'>地址</td><td colspan='3'>";
				if(data.province){
					html+=data.province+"-"+data.city;
					html+=data.address ? "-"+data.address : "";
				}else{
					html+=data.address ? data.address : "";
				}
				html+="</td></tr>";
				html+="<tr><td class='side_td'>其它信息</td><td colspan='3'>";
				html+=data.remark ? data.remark : "";
				html+="</td></tr>";
				html+="</table>";
				$("#detailModal").find(".modal-body").html(html).end().modal();
			}
		});
	});
});
</script>
</body>
</html>